import javafx.scene.text.Text;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class MaxsalarySortDriver {//
    public static void main(String[] args) throws IllegalArgumentException, ClassNotFoundException, IOException,
            InterruptedException {
        //2.获取配置信息，或者job对象实例
        Configuration configuration=new Configuration() ;
        Job job=Job.getInstance(configuration);
        //6.指定本程序的jar包所在的本地途径
        job.setJarByClass(MaxsalarySortDriver.class);
        //2.指定本业务job要使用的mapper/reducer业务类
        job.setMapperClass(MaxsalarySortMapper.class);
        job.setReducerClass(MaxsalarySortReducer.class);
        //3.指定mapper输出数据的kv类型
        job.setMapOutputKeyClass(MaxsalarySortFlowbean.class);
        job.setMapOutputValueClass(org.apache.hadoop.io.Text.class);
        //4.指定最终输出数据的kv类型
        job.setOutputKeyClass(NullWritable.class);
        job.setOutputValueClass(MaxsalarySortFlowbean.class);
        //5.指定job输入原始文件所在目录
        FileInputFormat.setInputPaths(job,new Path(args[0]));
        FileOutputFormat.setOutputPath(job,new Path(args[1]));
        //7.将job中配置的相关参数以及job所用的java类所在的jar包提交给yarn运行
        boolean result=job.waitForCompletion(true);
        System.exit(result?0:1);


    }
}
